﻿@model IEnumerable<blacksoft.Models.Almacen>

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_LayoutCompras.cshtml";
}


<div class="block big">
    <div class="titlebar">
        <h3>Mantener Productos en terminal</h3>
    </div>
    <div class="block_cont">
            <table class="data-table">
                <thead>
                    <tr>
                        <th>
                            @Html.DisplayNameFor(model => model.Producto.Nombre)
                        </th>
                        <th>
                            @Html.DisplayNameFor(model => model.StockActual)
                        </th>
                        <th>
                            @Html.DisplayNameFor(model => model.StockMin)
                        </th>
                        <th>
                            @Html.DisplayNameFor(model => model.StockMax)
                        </th>
                        @{
                            if ((bool)ViewBag.global)
                            {
                                <th>
                                    @Html.Raw("Terminal")
                                </th>
                            }
                        }
                        <th>ACCIONES</th>
                    </tr>
                </thead>

                @foreach (var item in Model)
                {
                    <tr @Html.Raw(item.StockActual < item.StockMin || item.StockActual > item.StockMax ? "style=\"background:rgba(194, 83, 83, 1);\"" : "")>
                        <td>
                            @Html.DisplayFor(modelItem => item.Producto.Nombre)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.StockActual)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.StockMin)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.StockMax)
                        </td>
                        @{
                        if ((bool)ViewBag.global)
                        {
                           <td>
                                @Html.DisplayFor(modelItem => item.Terminal.Nombre)
                            </td> 
                        }
                        }

                        
                        <td>
                            <div style="height: 3px;"></div>
                            <div class="actionbar">
                                <a href=@string.Concat("/ProductoTerminal/Details/", item.IdAlmacen) class="action view"><span>Detalles</span></a>
                                <a href=@string.Concat("/ProductoTerminal/Edit/", item.IdAlmacen) class="action edit"><span>Modificar</span></a>
                                <a href=@string.Concat("/ProductoTerminal/Delete/", item.IdAlmacen) class="action delete"><span>Eliminar</span></a>
                            </div>
                        </td>
                    </tr>
                }
            </table>
        </div>
</div>
